package com.bizmerce.rnd.oms.judgment.service.impl;


import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.bizmerce.rnd.oms.judgment.service.JuSearchVO;
import com.bizmerce.rnd.oms.judgment.service.JudgmentVO;

import egovframework.rte.psl.dataaccess.EgovAbstractDAO;

@SuppressWarnings("unchecked")
@Repository("judgmentDAO")
public class JudgmentDAO extends EgovAbstractDAO {
	/**
	 * 판정이력정보
	 * 
	 * 검색 조건 : Part No.
	 * @
	 */
	public List<JudgmentVO> selectJudgment(JuSearchVO searchVO) {
		int skipResult = (searchVO.getPageIndex() - 1) * searchVO.getPageUnit();
		int maxResult = searchVO.getPageUnit();
		
		HashMap<String, String> param = new HashMap<String, String>();
		param.put("partNo", searchVO.getPartNo());
		param.put("agreeCd", searchVO.getAgreeCd());
		param.put("apply", searchVO.getSatisfy());
		param.put("date", searchVO.getJudgmentDate());
		
		return getSqlMapClientTemplate().queryForList("Judgment.selectJudgment", param, skipResult, maxResult);
	}

	public int selectJudgmentCount(JuSearchVO searchVO) {//selectPartNo
		HashMap<String, String> param = new HashMap<String, String>();
		param.put("partNo", searchVO.getPartNo());
		param.put("agreeCd", searchVO.getAgreeCd());
		param.put("apply", searchVO.getSatisfy());
		param.put("date", searchVO.getJudgmentDate());
		return (Integer) getSqlMapClientTemplate().queryForObject("Judgment.selectJudgmentCount", param);
	}
	
	public JudgmentVO selectConfirm(String decisionNum) {
		HashMap<String, String> param = new HashMap<String, String>();
		param.put("decisionNum", decisionNum);
		return (JudgmentVO) getSqlMapClientTemplate().queryForList("Judgment.selectConfirm",param);
	}
}